package com.windgo.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.windgo.bean.bo.FootprintBO;
import com.windgo.bean.vo.WxFootprintListVO;
import com.windgo.mapper.MarketFootprintMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class WxFootprintServiceImpl implements WxFootprintService{
    @Autowired
    MarketFootprintMapper marketFootprintMapper;

    @Override
    public PageInfo<WxFootprintListVO> listWxFootprint(Integer page, Integer limit, Integer userId) {
        //TODO
        PageHelper.startPage(page,limit);
        List<WxFootprintListVO> wxFootprintListVOList = marketFootprintMapper.selectFootprint(userId);
        PageInfo<WxFootprintListVO> pageInfo = new PageInfo<>(wxFootprintListVOList);
        return pageInfo;
    }

    @Override
    public int deleteWxFootprint(FootprintBO footprintBO, Integer userId) {
        Integer id = footprintBO.getId();
        int affectedRows = marketFootprintMapper.deleteFootprint(id,userId);
        return affectedRows;
    }
}
